// JavaScript Document
schemes = jQuery.noConflict();

schemes().ready(function() {
					
                    schemes("#scheme-node-form").validate({
					rules: {
						'field_scheme_concern_department[und]': { 
							required: true,
							maxlength: 255,
							chkbadchar:true,
							valuenotequals: '_none',
						},
						'field_scheme_org[und]':{
						   required:true,
						   maxlength:255,
						   chkbadchar:true,
						   valuenotequals: '_none',
						},
						'field_scheme_concern_district[und][]':{
							multi_dist_select: true,
						},
						'title': { 
							required: true,
							minlength: 5,
							maxlength: 255,
							chkbadchar:true,
							splchar:true,
						},
						/*'field_scheme_associate[und]':{
							valuenotequals: '_none',
						},*/
						'field_scheme_sponsored_by[und]':{
							required: true,
							maxlength: 200,
							chkbadchar:true,	
						},
						'field_scheme_funding_pattern[und][0][value]':{
							minlength: 5,
							maxlength: 255,
							chkbadchar:true,
							splchar:true,
							},
						'field_scheme_description[und][0][value]':{
							required: true,
							minlength: 5,
							maxlength: 500,
							chkbadchar:true,
							splchar:true,
							},
							'field_scheme_beneficiaries[und]':{
							required:true,
							valuenotequals: '_none',
							},
							'field_scheme_benfits_type[und]':{
							required:true,
							valuenotequals: '_none',	
						},
						'field_scheme_eligible_income[und][0][value]':{
							digits:true,	
					 	},
						'field_scheme_eligibility[und][0][value]':{
							minlength: 5,
							maxlength: 255,
							chkbadchar:true,
							splchar:true,
							
								
						},
						'field_scheme_how_to_avail[und][0][value]':{
							required:true,
							minlength: 5,
							maxlength: 255,
							chkbadchar:true,
							splchar:true,
						},
						'field_scheme_reference_url[und][0][value]':{
							 required: "#edit-field-scheme-type-und-online:checked",
                             url: true,
						},
						'field_scheme_introduced_on[und][0][value][date]':{
							required: true,
                           				chkbadchar:true,
                           				dateformat:true,
 							//date_notless_tdy:true,
							date_notgreater_tdy:true,	
						},
						'files[field_scheme_upload_und_0]':{
							required: "#edit-field-scheme-type-und-download:checked",
                            chkfile_format_size: true,
							},
							'field_scheme_keywords[und][0][value]':{
							required:true,
							minlength: 5,
							maxlength: 255,
							chkbadchar:true,
							splchar:true,
								},
					},
						
						messages: {
							'field_scheme_concern_department[und]':{
							required: 'Please Select Concerned Department',
							maxlength:  'Maximum 255 character only allowed',
							chkbadchar: 'insert, select, update, delete, drop, alter, change, modify not allowed.',
							valuenotequals: 'Please Select Concerned Department',
							},
							'field_scheme_org[und]':{
							required: 'Please Select Organization',
							maxlength:  'Maximum 255 character only allowed',
							chkbadchar: 'insert, select, update, delete, drop, alter, change, modify not allowed.',	
							valuenotequals: 'Please Select Organisation Name',	
							},
							'field_scheme_concern_district[und][]':{
							required: 'Please Select Districts',
							maxlength:  'Maximum 255 character only allowed',
							chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',	
							multi_dist_select: 'Please Select either All or Particular Districts',	
								
							},
							'title': { 
							required:  'Please enter Title',
							minlength: 'Minimum 5 characters should be entered',
							maxlength: 'Maximum 255 character only allowed',
							chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',
							splchar:'Special Characters are not allowed',
						},
						/*'field_scheme_associate[und]':{
							valuenotequals: 'Please Select Associated Major Scheme',
					   },*/
					   'field_scheme_sponsored_by[und]':{
							required: 'Please select Sponsored By',
							maxlength:  'Invalid option',
							chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',	
						},
						'field_scheme_funding_pattern[und][0][value]':{
							minlength: 'Minimum 5 characters should be entered',
							maxlength:  'Maximum 255 character only allowed',
							chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',
							splchar:'","`","!","@","#","schemes","%","^","&" not allowed',
						},
						'field_scheme_description[und][0][value]': { 
							required:  'Please enter Description',
							minlength: 'Minimum 5 characters should be entered',
							maxlength: 'Maximum 500 character only allowed',
							chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',
							splchar:'Special Characters are not allowed',
						},
						'field_scheme_beneficiaries[und]':{
							required:'Please Select Beneficiaries',
							valuenotequals: 'Select the Beneficiaries',
							},
							'field_scheme_benfits_type[und]':{
							required:'Please Select Benefit Type',
							valuenotequals: 'Select the Benefit Type',	
						},
						'field_scheme_eligible_income[und][0][value]':{
							digits:'Please Enter only Digits',	
					 },
					 'field_scheme_eligibility[und][0][value]': { 
							
							minlength: 'Minimum 5 characters should be entered',
							maxlength: 'Maximum 255 character only allowed',
							chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',
							splchar:'Special Characters are not allowed',
						},
						'field_scheme_how_to_avail[und][0][value]':{
							required:'Please Enter how to avail',
							minlength: 'Minimum 5 characters should be entered',
							maxlength: 'Maximum 255 character only allowed',
							chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',
							splchar:'Special Characters are not allowed',
							},
							'field_scheme_keywords[und][0][value]': { 
							required:  'Please enter Title',
							minlength: 'Minimum 5 characters should be entered',
							maxlength: 'Maximum 255 character only allowed',
							chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',
							splchar:'Special Characters are not allowed',
						},
						'field_scheme_introduced_on[und][0][value][date]':{
							required: 'Please Choose Introduced On Date',
                            			dateformat: 'Invalid Date format',
							chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',
							date_notgreater_tdy: 'Introduced Date should not be greater than today date.'

						},
						'files[field_scheme_upload_und_0]':{
							 required: "Please Enter URL",
							 url: 'Not Valid URL',
							},
							/*'field_scheme_reference_url[und][0][value]':{
							 required: "#edit-field-scheme-type-und-online:checked",
                             url: true,
						},*/
						
						},
							invalidHandler: function(form, validator) {
       
       					 if (!validator.numberOfInvalids())
								return;
						else{
							
							  //schemes("#documents-node-form").create_errormsg_container('errormsg_container','documents-node-form');
						}
							
							schemes('html, body').animate({
								scrollTop: schemes(validator.errorList[0].element).offset().top - 100
							}, 1000);
							
						},
				

   
	});




            
});
							